package com.leenmvc.core.exception;

import com.leenmvc.core.base.BaseEntity;
import com.leenmvc.core.utils.TipUtil;

/**
 * 业务层自定义异常
 *
 */
public class BusinessException extends RuntimeException {

    private String message;

    private Exception e;

    public BusinessException(String message) {
        this.message = message;
    }

    public BusinessException(String message, Class<?> cls) {
        this.message = TipUtil.getTip(message, BaseEntity.getTableName(cls));
    }

    public BusinessException(String message, Exception e) {
        this.message = message;
        this.e = e;
    };

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return message;
    }

}
